package com.zpself.module.算法练习.计算;

/**
 * @author By ZengPeng
 * @Description
 * @date in  2021/1/20 19:13
 * @Modified By
 */
public class 力扣_645_错误的集合 {
    public static void main(String[] args) {

       myAnswer(new int[]{1,2,3,4,5,5});
    }

    public static int[] myAnswer(int[] nums){
        int[] position = new int[nums.length+1];
        int[] result = new int[2];
        for (int i : nums) {
            position[i]+=1;
        }
        for (int i = 0; i < position.length; i++) {
            if(position[i]==0)
                result[1] = i;
            if(position[i]==2)
                result[0] = i;
        }
        System.out.println(result[0]+"-"+result[1]);
        return result;
    }
}
